"""
merge node centrality data together between 1981 and 2015

Author: Shaoyu Liu
Date: 2023-03-29
"""
import pandas as pd
import os
import glob
import numpy as np
os.chdir(r'/Volumes/Zihao_SSD2/PatentsView/')
df_list=[]

for year in range(1981, 2016):
    print(year)
    file = f"centrality_results/centrality_{year}_degree.csv"
    df = pd.read_csv(file)
    df['year']=year
    df_list.append(df)

df_all = pd.concat(df_list, ignore_index=True)
del df_list
df_all['year'] = df_all['year'].astype('int16')

print('Export dataset...')
df_all.to_csv("cleandata/centrality_sum_1981_2015.csv", index=False)